package org.col.dspace.tagger.submit.ui;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.col.dspace.tagger.model.TagGenerator;

public class Response {
	
	private String status;
	private String message;
	private ArrayList<String> tags;
	
	private Response(){
		
	}
	
	public static Response createResponse(HttpServletRequest request, int status){
		
		if(status==TagGenerator.STATUS_TAG_GEN_FAILED){
			Response resp = new Response();
			resp.status="FAIL";
			resp.message="Generating Tags Failed";
			return resp;
		}else if(status == TagGenerator.STATUS_TAG_GEN_WRONG_FORMAT){
			Response resp = new Response();
			resp.status = "FAIL";
			resp.message = "File Format not supported";
			return resp;
		}else if(status== TagGenerator.STATUS_TAG_GEN_SUCCESS){
			Response resp = new Response();
			resp.status = "SUCCESS";
			resp.tags = (ArrayList<String>) request.getAttribute("tags");
			return resp;
		}
		
		return null;
		
		
	}

}
